package com.exchange.dto;

import com.exchange.entity.Merchant;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
public class MerchantDto {
    private Long id;
    private Long userId;
    private String businessName;
    private String businessLicense;
    private String contactPerson;
    private String address;
    private Merchant.SubscriptionType subscriptionType;
    private LocalDate subscriptionStartDate;
    private LocalDate subscriptionEndDate;
    private Integer maxProducts;
    private Integer maxExchangeCodes;
    private Integer maxOrdersPerMonth;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    public static MerchantDto fromEntity(Merchant merchant) {
        MerchantDto dto = new MerchantDto();
        dto.setId(merchant.getId());
        dto.setUserId(merchant.getUserId());
        dto.setBusinessName(merchant.getBusinessName());
        dto.setBusinessLicense(merchant.getBusinessLicense());
        dto.setContactPerson(merchant.getContactPerson());
        dto.setAddress(merchant.getAddress());
        dto.setSubscriptionType(merchant.getSubscriptionType());
        dto.setSubscriptionStartDate(merchant.getSubscriptionStartDate());
        dto.setSubscriptionEndDate(merchant.getSubscriptionEndDate());
        dto.setMaxProducts(merchant.getMaxProducts());
        dto.setMaxExchangeCodes(merchant.getMaxExchangeCodes());
        dto.setMaxOrdersPerMonth(merchant.getMaxOrdersPerMonth());
        dto.setCreatedAt(merchant.getCreatedAt());
        dto.setUpdatedAt(merchant.getUpdatedAt());
        return dto;
    }
}